package com.aivin.maproutelib.bean;

import android.graphics.Bitmap;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.Marker;


public class GaoDeMarker{
    private Marker marker;

    public GaoDeMarker(Marker marker) {
        this.marker = marker;
    }

    private Object getOriginal() {
        return marker;
    }

    public LatLng getPosition() {
        return marker.getPosition();
    }

    public void setRotate(float degree) {
        marker.setRotateAngle(-degree);
    }


    public void setIcon(Bitmap bitmap) {
        marker.setIcon(BitmapDescriptorFactory.fromBitmap(bitmap));
    }

    public void setSnippet(String s) {
        marker.setSnippet(s);
    }

    public String getSnippet() {
        return marker.getSnippet();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        GaoDeMarker that = (GaoDeMarker) o;

        Object original = that.getOriginal();
        if (original == marker) return true;
        Marker marker1 = (Marker) original;
        if (marker1.getPosition().latitude == marker.getPosition().latitude
                && marker1.getPosition().longitude == marker.getPosition().longitude) {
            return true;
        }
        return marker1.getId().equals(marker.getId());
    }

    public void remove() {
        marker.remove();
    }
}
